package com.lintcode.solution;

import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;

public class Solution_49 {
    public static void main(String[] agrs) {
        //        char[] chars = "DERLKAJKFKLAJFKAKLFJKLJFa".toCharArray();
        //        char[] chars = "DERLKAJKFklajfkaklfjkljfa".toCharArray();
        char[] chars = "A".toCharArray();
        //        char[] chars = { 'a', 'd', 'b', 'A', 'c', 'C', 'B' };
        //        Arrays.sort(chars);
        
        Solution_49 solution = new Solution_49();
        solution.sortLetters(chars);
        System.out.println(new String(chars));
    }
    
    public void sortLetters(char[] chars) {
        if (chars == null || chars.length == 0) {
            return;
        }
        Arrays.sort(chars);
        System.out.println(new String(chars));
        int length = chars.length;
        for (int i = 0; i < (length % 2 == 0 ? length / 2 : length / 2 + 1); i++) {
            char temp = chars[ i ];
            chars[ i ] = chars[ length - i - 1 ];
            chars[ length - i - 1 ] = temp;
        }
    }
}
